package com.atde._05_behavioral_design_patterns.command.remotecontrol;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._05_behavioral_design_patterns.command.remotecontrol
 * @Author: Del
 * @CreateTime: 2025-06-26  09:32
 * @Description: 命令模式：具体的命令类
 * @Version: 1.0
 */
public class TVOnCommand implements  Command{

    // 聚合接收者
    private TVReceiver tv;

    // 构造器
    public TVOnCommand(TVReceiver tv) {
        this.tv = tv;
    }

    @Override
    public void execute() {
        // 调用接收者的方法：打开
        tv.on();
    }

    @Override
    public void undo() {
        // 调用接收者的方法：关闭
        tv.off();
    }
}
